package com.huawei.appgallery.foundation.ui.framework.widget.imageview;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.ImageView;
import androidx.annotation.Nullable;
import com.bumptech.glide.Glide;
import o.cko;
import o.dky.a;
import o.dky.o;
import o.eqx;
import o.ro;
import o.si;
import o.tf;
import o.zn;

public class RoundedCornerImageView extends ImageView {
    private int ʻ;
    private int ʼ;
    private ro<Bitmap> ˊ;
    private Drawable ˋ;
    private int ˎ;
    private int ˏ;
    private int ॱ;
    private String ॱॱ;
    private tf ᐝ;

    public RoundedCornerImageView(Context context) {
        this(context, null);
    }

    public RoundedCornerImageView(Context context, @Nullable AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public RoundedCornerImageView(Context context, @Nullable AttributeSet attributeSet, int i) {
        Drawable drawable;
        int i2 = 0;
        super(context, attributeSet, i);
        this.ᐝ = tf.ˋ;
        this.ˊ = Glide.ˏ(getContext()).ॱ();
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, o.ʽʽ, i, 0);
        if (obtainStyledAttributes.hasValue(o.ʾˊ)) {
            i2 = obtainStyledAttributes.getDimensionPixelSize(o.ʾˊ, 0);
        }
        this.ॱ = i2;
        this.ˎ = obtainStyledAttributes.getDimensionPixelSize(o.ʿᐝ, this.ॱ);
        this.ˏ = obtainStyledAttributes.getDimensionPixelSize(o.ˆ, this.ॱ);
        this.ʼ = obtainStyledAttributes.getDimensionPixelSize(o.ˇ, this.ॱ);
        this.ʻ = obtainStyledAttributes.getDimensionPixelSize(o.ʿˋ, this.ॱ);
        if (obtainStyledAttributes.hasValue(o.ʾˋ)) {
            drawable = obtainStyledAttributes.getDrawable(o.ʾˋ);
        } else {
            drawable = getResources().getDrawable(a.ॱॱ);
        }
        this.ˋ = drawable;
        obtainStyledAttributes.recycle();
    }

    protected void dispatchDraw(Canvas canvas) {
        super.dispatchDraw(canvas);
        if (this.ˋ != null && !isInEditMode()) {
            this.ˋ.setBounds(0, 0, getWidth(), getHeight());
            this.ˋ.draw(canvas);
        }
    }

    protected void drawableStateChanged() {
        if (this.ˋ != null) {
            this.ˋ.setState(getDrawableState());
            invalidate();
        }
        super.drawableStateChanged();
    }

    public RoundedCornerImageView ˊ(String str) {
        this.ॱॱ = str;
        return this;
    }

    public RoundedCornerImageView ˊ(zn znVar) {
        this.ˊ.ॱ(znVar);
        return this;
    }

    private void ˎ(si<Bitmap> siVar) {
        ((ro) ((ro) this.ˊ.ˊ(this.ᐝ)).ˏ((si) siVar)).ˏ((ImageView) this);
    }

    public void ˎ() {
        eqx.ˏ(this.ˊ, this.ॱॱ, (ImageView) this);
        ˎ(new cko((float) this.ˎ, (float) this.ˏ, (float) this.ʼ, (float) this.ʻ));
    }

    public RoundedCornerImageView ˏ(String str) {
        this.ˊ.ˎ(str);
        return this;
    }
}
